<?php
header('Content-Type:text/html;charset=UTF-8');
include 'lib/checker.php';

@$pid = $_REQUEST['pid'];
@$type = $_REQUEST['type'];
@$content = $_REQUEST['content'];

$title = '添加号码错误提示';
$jumpUrl = 'listperson.php';

if(empty($pid)){
	$message = '获取联系人信息出错';
	include 'lib/message.php';
	die;
}

$jumpUrl = 'editPerson.php?pid='.$pid;

if($type=='请选择'){
	$message = '号码类型必须选定';
	include 'lib/message.php';
	die;
}

if(empty($content)){
	$message = '号码内容必须填写';
	include 'lib/message.php';
	die;
}

require 'lib/db.php';
$flag = dbInsert('insert into number(type,content,pid) values(:type,:content,:pid)',array('type'=>$type,'content'=>$content,'pid'=>$pid));

if(!$flag){
	$message = '添加号码失败';
	include 'lib/message.php';
	die;
}
header('location:editPerson.php?pid='.$pid);